<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- definition of simple types --> 
<xsd:simpleType name="languageType">
 <xsd:restriction base="xsd:string">
  <xsd:enumeration value="EN"/>
  <xsd:enumeration value="ES"/>
  <xsd:enumeration value="IT"/>
  <xsd:enumeration value="NL"/>
 </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="initialType">
 <xsd:restriction base="xsd:string">
  <xsd:maxLength value="1" />
 </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="inclusiveType">
 <xsd:restriction base="xsd:integer">
  <xsd:minInclusive value="1" />
 </xsd:restriction>
</xsd:simpleType>


<xsd:simpleType name="non-empty-string">
 <xsd:restriction base="xsd:string">
  <xsd:minLength value="1"/>
 </xsd:restriction>
</xsd:simpleType>

<xsd:element name="search" type="non-empty-string" />
<xsd:element name="replace" type="non-empty-string" />
<xsd:element name="counter" type="inclusiveType" />
<xsd:element name="from" type="languageType" />
<xsd:element name="to" type="languageType" />
<xsd:element name="total" type="inclusiveType" />
<xsd:attribute name="initial" type="initialType" />

<xsd:element name="translation">
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element ref="search" />
   <xsd:element ref="counter" />
   <xsd:element ref="replace" maxOccurs="unbounded" />
  </xsd:sequence>
  <xsd:attribute ref="initial" use="required" />
 </xsd:complexType>
</xsd:element>

<xsd:element name="Dictionary">
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element ref="from" />
   <xsd:element ref="to" />
   <xsd:element ref="total" />
   <xsd:element ref="translation" maxOccurs="unbounded" />
  </xsd:sequence>
 </xsd:complexType>
 <xsd:unique name="searchKey">
  <xsd:selector xpath="translation" />
  <xsd:field xpath="search"/>
 </xsd:unique>
</xsd:element>

</xsd:schema>
